package com.qf.pojo;

import com.qf.utils.DBUtils;

import java.sql.SQLException;
import java.util.Arrays;

public class Student extends User{

    private String hobbies;

    public Student() {
    }

    public Student(String username, String password, String name, String sex, int age, String photo, String hobbies) {
        super(username, password, name, sex, age, photo);
        this.hobbies = hobbies;
    }

    public String getHobbies() {
        return hobbies;
    }

    public void setHobbies(String hobbies) {
        this.hobbies = hobbies;
    }

    @Override
    public String toString() {
        return "Student{" +
                "hobbies='" + hobbies + '\'' +
                "} " + super.toString();
    }

    //做分页的假数据
    public static void main(String[] args) {
        for (int i = 1; i < 100; i++) {
            String username = "student" + i;
            String password = "123456";
            String name = "学生" + i;
            String sex = "男";
            int age = 23;
            String hobbies = "football,basketball";
            try {
                DBUtils.commonUpdate("insert into student(username,password,name,sex,age,hobbies) values(?,?,?,?,?,?)",username,password,name,sex,age,hobbies);
            } catch (SQLException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
